﻿using System;
using System.Collections.Generic;

namespace fluentvaly
{
    public abstract class BaseValidationSetUp
    {
        protected bool ThrowsException { get; private set; }
        protected string DefaultInvalidationMessage { get; private set; }
        protected InvalidationReasons DefaultInvalidationReason { get; private set; }

        private IList<IValidationStatement> Validators { get; set; }

        protected BaseValidationSetUp(bool throwsException, string defaultInvalidationMessage, InvalidationReasons defaultInvalidationReason)
        {
            Validators = new List<IValidationStatement>();
            ThrowsException = throwsException;
            DefaultInvalidationMessage = defaultInvalidationMessage;
            DefaultInvalidationReason = defaultInvalidationReason;
        }

        protected BaseValidationSetUp(bool throwsException) : this(throwsException, string.Empty, InvalidationReasons.Invalid)
        {
        }

        protected void AddMemeberValidator(IValidationStatement validator)
        {
            Validators.Add(validator);
        }

        public abstract Type GetDefinedType();

        public IEnumerable<IValidationStatement> ValidationStatements
        {
            get
            {
                return Validators;
            }
        }
    }
}
